package com.ruoyi.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.domain.ServiceClockin;
import com.ruoyi.service.service.IServiceClockinService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 定位打卡拍照表Controller
 * 
 * @author ZDL
 * @date 2025-03-11
 */
@RestController
@RequestMapping("/service/clockin")
public class ServiceClockinController extends BaseController
{
    @Autowired
    private IServiceClockinService serviceClockinService;

    /**
     * 查询定位打卡拍照表列表
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceClockin serviceClockin)
    {
        startPage();
        List<ServiceClockin> list = serviceClockinService.selectServiceClockinList(serviceClockin);
        return getDataTable(list);
    }

    /**
     * 导出定位打卡拍照表列表
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:export')")
    @Log(title = "定位打卡拍照表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceClockin serviceClockin)
    {
        List<ServiceClockin> list = serviceClockinService.selectServiceClockinList(serviceClockin);
        ExcelUtil<ServiceClockin> util = new ExcelUtil<ServiceClockin>(ServiceClockin.class);
        util.exportExcel(response, list, "定位打卡拍照表数据");
    }

    /**
     * 获取定位打卡拍照表详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:query')")
    @GetMapping(value = "/{clockinId}")
    public AjaxResult getInfo(@PathVariable("clockinId") Long clockinId)
    {
        return success(serviceClockinService.selectServiceClockinByClockinId(clockinId));
    }

    /**
     * 新增定位打卡拍照表
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:add')")
    @Log(title = "定位打卡拍照表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServiceClockin serviceClockin)
    {
        return toAjax(serviceClockinService.insertServiceClockin(serviceClockin));
    }

    /**
     * 修改定位打卡拍照表
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:edit')")
    @Log(title = "定位打卡拍照表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServiceClockin serviceClockin)
    {
        return toAjax(serviceClockinService.updateServiceClockin(serviceClockin));
    }

    /**
     * 删除定位打卡拍照表
     */
    @PreAuthorize("@ss.hasPermi('service:clockin:remove')")
    @Log(title = "定位打卡拍照表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{clockinIds}")
    public AjaxResult remove(@PathVariable Long[] clockinIds)
    {
        return toAjax(serviceClockinService.deleteServiceClockinByClockinIds(clockinIds));
    }
}
